$(function  () {
     layui.use('form', function(){
        var form = layui.form;
              //监听提交
        form.on('submit(login)', function(data){
	        var username  = $("#username").val();	
	        var password = $("#password").val();
	        $("form[name='form1']").attr('action','/');	
	           	document.forms[0].submit();
           });
      });
     
    var _topWin = window;    
 	while (_topWin != _topWin.parent.window) {    
 	     _topWin = _topWin.parent.window;    
 	}    
 	if (window != _topWin)
 		_topWin.document.location.href = '/index';  
})
        
